<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>H+ 后台主题UI框架 - 空白页</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="__STATIC__/layout/favicon.ico">
    <link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__STATIC__/layout/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <!-- jqgrid-->
    <link href="__STATIC__/layout/css/plugins/jqgrid/ui.jqgrid.css?0820" rel="stylesheet">
    <link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
    <link rel="stylesheet" href="__STATIC__/layout/css/zTreeStyle.css" type="text/css">
     <script src="__STATIC__/layout/js/jquery.min.js?v=2.1.4"></script>
    <script src="__STATIC__/sc/js/page.js"></script>
    <style type="text/css">
      .select{padding: 2px 12px;}
    </style>
</head>

<body style="color:#333;padding:3px;">
    <!-- 标题 -->
    <div class="page-heade">
        <h2 class="title_color text-center">网点销售目标格式管理</h2>
    </div>
    <!-- 标题 -->
    <div class="padd col-md-12">
        <a onclick="out_pop()" href="###" class="btn btn-sm btn-success">添加导购目标格式</a>
    </div>
    <!-- 筛选 -->
     <form action="#" method="post" id="form_check" accept-charset="utf-8" class="container-fluid bud_dl formpage">
                      <input type="hidden" value='{$page}' name="page" id="page-go"/>
                      <input type="hidden" value='{$list}' name="list" id="list-go"/>
        <div class="form-group table">
            <label for="exampleInputName2">财年：</label>
           	<select class="form-control" name="cid" id="cid" style="width: 160px;">
           		<option value="0">--请选择--</option>
             	{volist name="cn" id="vo"}
             		{if condition="$cid"}
             		<option value='{$vo.id}'>{$vo.title}</option>
             		}
             	{/volist}
            </select>
        </div>
        <div class="col-md-12 margin-10">
            <input type="button" value="查询" class='btn btn-outline btn-primary' id="check"/>
             <input type="button" value="清空查询条件" class='btn btn-outline btn-warning' id="clear_check"/>
        </div>
    </form>
    <!-- 筛选 -->
    <!-- 表格 -->
    <div class="col-md-12 no-padding" style="padding: 0 12px;">
     {if condition="$sum neq 0"}
        <table class="table table-striped table-bordered table-hover bud_hei text-center  table-responsive" style="width: 100%; background: #fff;">
            <tr class="info">
                <th class="text-center">No.</th>
                <th class="text-center">财年</th>
                <th class="text-center">创建人</th>
                <th class="text-center">创建时间</th>
                <th class="text-center">操作</th>
            </tr>  
            {volist name="apply" id="vo"}     
            <tr>
              <td>{$i}</td>
              <td>{$vo.cainian}</td>
              <td>{$vo.cname}</td>
              <td>{$vo.created_on}</td>
              <td><a onclick="modify({$vo.id})">修改</a></td>
            </tr>
            {/volist}
           
        </table>
       <h5 class="text-center" id="pagesc" style="font-size: 16px;font-weight: 500">
            <script>
                            $(function(){
                                pageSC("pagesc",{$sum},{$page},{$maxpage})
                            })
                        </script>
          每页显示
          <select id="pagesize">
            <option value='10' {if condition="$list eq 10"}selected{/if}>10条</option>
            <option value='15'{if condition="$list eq 15"}selected{/if}>15条</option>
            <option value='20'{if condition="$list eq 20"}selected{/if}>20条</option>

          </select>
        </h5>
        {else/}
        <h3>对不起没有查询到符合条件的信息</h3>
    {/if}
    </div>
    <!-- 表格 -->
    <div>
    </div>
    </div>
    <div class="outlete_pop output_pop" style="display: none;">
      <form method="post" id="newtar" accept-charset="utf-8">
        <dl class="margin-10 container-fluid">
          <dt class="col-sm-4 text-right">是否设置产品维度<em class="colorRed">*</em>：</dt>
          <dd class="col-sm-8">
            <input type="radio" name="product" value="1" checked class="show_next"/>
            <label>是</label>
            <input type="radio" name="product" value="0" class="hide_next"/>
            <label>否</label>
          </dd>
        </dl>

        <dl class="margin-10 container-fluid">
          <dt class="col-sm-4 text-right">产品维度<em class="colorRed">*</em>：</dt>
          <dd  class="col-sm-8">
            <select class="form-control select" id="product_id" name="product_id">
             {volist name='lists' id="vo"}
				{if condition="$vo.pname eq '产品'"}
										
										
				<option value='{$vo.id}'>{$vo.field_name}</option>
										
				{/if}
			{/volist}
            </select>
          </dd>
        </dl>
        <dl class="margin-10 container-fluid">
          <dt class="col-sm-4 text-right">财年<em class="colorRed">*</em>：</dt>
          <dd  class="col-sm-8">
            <select class="form-control" name="cainian">
             	{volist name="cn" id="vo"}
             		<option value='{$vo.id}'>{$vo.title}</option>
             	{/volist}
            </select>
          </dd>
        </dl>
        <dl class="margin-10 container-fluid">
          <dt class="col-sm-4 text-right">考核期维度<em class="colorRed">*</em>：</dt>
          <dd  class="col-sm-8">
            <select class="form-control select" id="kaoheqi" name="kaoheqi">
             {volist name='lists' id="vo"}
				{if condition="$vo.pname eq '考核期'"}
										
				<option value='{$vo.id}'>{$vo.field_name}</option>
										
				{/if}
			{/volist}
            </select>
          </dd>
        </dl>
      </form>
    </div>
    <div class="btn_outs hide">
      <div class="btn_outs_pop">
        <i class="fa fa-close"></i>
        <p>财年：2017已存在导购目标格式,不允许重复!</p>
      </div>
    </div>
    <div class="output_pop1" style="display: none;">
      <form id="updatetar" method="post" accept-charset="utf-8">
        <dl class="margin-10 container-fluid">
        <input type="hidden" name="fid" value="" id="fid"/>
          <dt class="col-sm-4 text-right"> 是否设置过网点目标格式：</dt>
          <dd class="col-sm-8">
           <p>已设置过网点目标格式，请查看导入格式是否正确：<a href="javascript:;" id="down">网点目标导入格式</a></p>
          </dd>
        </dl>
        <dl class="margin-10 container-fluid">
          <dt class="col-sm-4 text-right">是否设置产品维度<em class="colorRed">*</em>：</dt>
          <dd class="col-sm-8">
            <input type="radio" name="product" id="choosep" value="1" checked class="show_next"/>
            <label>是</label>
            <input type="radio" name="product" id="choosenop" value="0" class="hide_next"/>
            <label>否</label>
          </dd>
        </dl>

        <dl class="margin-10 container-fluid" id="ph">
          <dt class="col-sm-4 text-right">产品维度<em class="colorRed">*</em>：</dt>
          <dd  class="col-sm-8">
            <select class="form-control select" name="product_id" id="prose">
              {volist name='lists' id="vo"}
				{if condition="$vo.pname eq '产品'"}
										
										
				<option value='{$vo.id}'>{$vo.field_name}</option>
										
				{/if}
				{/volist}
            </select>
          </dd>
        </dl>
        <dl class="margin-10 container-fluid">
          <dt class="col-sm-4 text-right">财年<em class="colorRed">*</em>：</dt>
          <dd  class="col-sm-8">
           <input type="text" readonly="" id="cntext" class="form-control"/>
          </dd>
        </dl>
        <dl class="margin-10 container-fluid">
          <dt class="col-sm-4 text-right">考核期维度<em class="colorRed">*</em>：</dt>
          <dd  class="col-sm-8">
           <select class="form-control select" id="khse" name="kaoheqi">
             {volist name='lists' id="vo"}
				{if condition="$vo.pname eq '考核期'"}
										
				<option value='{$vo.id}'>{$vo.field_name}</option>
										
				{/if}
			{/volist}
            </select>
          </dd>
        </dl>
      </form>
    </div>
    <!-- 全局js -->
    <script src="__STATIC__/layout/js/bootstrap.min.js?v=3.3.6"></script>
    <!-- <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
    <script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
    <script src="__STATIC__/layout/js/plugins/layer/layer.min.js"></script>
   
    <script src="__STATIC__/layout/js/content.js?v=1.0.0"></script>
    <script src="__STATIC__/layout/js/plugins/sweetalert/sweetalert.min.js"></script>
    <!-- ztree -->
    <script type="text/javascript" src="__STATIC__/layout/js/jquery.ztree.core.js"></script>
    <script type="text/javascript" src="__STATIC__/layout/js/jquery.ztree.excheck.js"></script>
    <!-- <script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script> -->
    <!--统计代码，可删除-->
    <script src="__STATIC__/layout/js/plugins/layer/laydate/laydate.js"></script>
    <script>
        //翻页
       
        $("#check").click(function(){
              $("#page-go").val(1);
              $(".formpage").submit();
        })
        $("#clear_check").click(function(){
          	$("#cid").val(0);
            $(".formpage").submit();
        })
   	$(function(){
   		$(".show_next").change(function(){
   			if($(this).prop("checked")){
				$(this).parent().parent().next().show();
			}
   		})
   		$(".hide_next").change(function(){
   			if($(this).prop("checked")){
				$(this).parent().parent().next().hide();
			}
   		})

   	})
   	$("#down").click(function(){
   		location.href="{:url('Xitongexcel/wangdian')}?fid="+$("#fid").val();
   	})
    </script>
    <script type="text/javascript">
      function out_pop(){
       layer.open({
        type: 1,
        skin: 'layui-layer-demo', //样式类名
        title:'目标格式管理',
        closeBtn: 1, //不显示关闭按钮
        anim: 2,
        area: ['600px', '400px'], //宽高
        shadeClose: true, //开启遮罩关闭
        btn:['保存'],
        yes:function(){
           $.ajax({
                cache: true,
                type: "POST",
                url:"{:url('Wangdian/baocun')}",
                data:$('#newtar').serialize(),// 你的formid
                async: false,
                error: function(request) {
                    alert("Connection error");
                },
                success: function(re) {
                	if(re!=""){
                		var res=JSON.parse(re);
                		layer.msg(res["msg"]);
                	}else{
                		layer.msg("系统繁忙请稍后再试");
                	}
                }
                	
            });
        },
        content: $('.output_pop')
      });
      };
      function modify(fid){
      	$("#fid").val(fid);
      	$.post("{:url('Wangdian/gettar')}",{fid:fid},function(re){
      		var data=JSON.parse(re);
      		if(data["product_id"]==""||data["product_id"]==null){
      			$("#choosenop").prop("checked",true);
      			$("#ph").hide();
      		}else{
      			$("#choosep").prop("checked",true);
      			$("#ph").show();
      			$("#prose").val(data["product_id"]);
      			
      		}
      		$("#cntext").val(data["title"]);
      		$("#khse").val(data["kaoheqi"]);
      		var index=layer.open({
	          type: 1,
	          skin: 'layui-layer-demo', //样式类名
	          title:'目标格式管理',
	          closeBtn: 1, //不显示关闭按钮
	          anim: 2,
	          area: ['600px', '400px'], //宽高
	          shadeClose: true, //开启遮罩关闭
	          btn:['保存'],
	          yes:function(){
	            layer.close(index) 
	             $.ajax({
                cache: true,
                type: "POST",
                url:"{:url('Wangdian/xiugai')}",
                data:$('#updatetar').serialize(),// 你的formid
                async: false,
                error: function(request) {
                    alert("Connection error");
                },
                success: function(re) {
                	if(re!=""){
                		var res=JSON.parse(re);
                		layer.msg(res["msg"]);
                	}else{
                		layer.msg("系统繁忙请稍后再试");
                	}
                }
                	
            	});
	            
	          },
	          content: $('.output_pop1')
	        });
      	})
       
      }
     
    </script>
</body>

</html>